

package com.hazelcast.internal.util.phonehome;

import com.hazelcast.instance.impl.Node;
import com.hazelcast.sql.impl.InternalSqlService;

import static com.hazelcast.internal.util.phonehome.PhoneHomeMetrics.SQL_QUERIES_SUBMITTED;
import static com.hazelcast.internal.util.phonehome.PhoneHomeMetrics.SQL_STREAMING_QUERIES_EXECUTED;

class SqlMetricsProvider implements MetricsProvider {

    @Override
    public void provideMetrics(Node node, MetricsCollectionContext context) {
        InternalSqlService sqlService = node.getNodeEngine().getSqlService();

        long sqlQueriesSubmittedCount = sqlService.getSqlQueriesSubmittedCount();
        context.collect(SQL_QUERIES_SUBMITTED, sqlQueriesSubmittedCount);

        long sqlStreamingQueriesExecutedCount = sqlService.getSqlStreamingQueriesExecutedCount();
        context.collect(SQL_STREAMING_QUERIES_EXECUTED, sqlStreamingQueriesExecutedCount);
    }
}
